<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script>
        window.onload = function(){
            var a = document.getElementsByTagName("input");
            a[3].onclick = function(){
                var r =  Number(a[0].value);
                a[1].value = 2 * Math.PI * r;
                a[2].value = Math.PI * r * r;
            }
            a[4].onclick = function(){
                a[0].value = "";
                a[1].value = "";
                a[2].value = "";
            }
        }
    </script>
</head>
<body>
    <h3>圆的周长和面积</h3>
    半径<input type="text" placeholder="请输入半径"><br>
    周长<input type="text" placeholder="周长"><br>
    面积<input type="text" placeholder="面积"><br>
    <input type="button" value="确定">
    <input type="button" value="重置">
</body>
</html>